
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import DrawPage from './pages/DrawPage.tsx';
import GroupsPage from './pages/GroupsPage.tsx';
import TournamentPage from './pages/TournamentPage.tsx';
import MatchResultPage from './pages/MatchResultPage.tsx';
import BracketPage from './pages/BracketPage.tsx';
import CaptainDrawPage from './pages/CaptainDrawPage.tsx';
import RoundManagePage from './pages/RoundManagePage.tsx';
import TournamentControlPage from './pages/TournamentControlPage.tsx';
import AdminProtected from './components/AdminProtected.tsx';

const App: React.FC = () => {
  return (
    <Router>
      <Routes>
        {/* 首页 - 队长抽签页面 */}
        <Route path="/" element={<CaptainDrawPage />} />

        {/* 管理员后台 - 需要密码认证 */}
        <Route path="/admin" element={<AdminProtected><TournamentPage /></AdminProtected>} />
        <Route path="/tournament" element={<AdminProtected><TournamentPage /></AdminProtected>} />
        <Route path="/match-result" element={<AdminProtected><MatchResultPage /></AdminProtected>} />
        <Route path="/bracket" element={<AdminProtected><BracketPage /></AdminProtected>} />
        <Route path="/round-manage" element={<AdminProtected><RoundManagePage /></AdminProtected>} />
        <Route path="/tournament-control" element={<AdminProtected><TournamentControlPage /></AdminProtected>} />

        {/* 队长抽签页面（备用路径） */}
        <Route path="/draw" element={<CaptainDrawPage />} />

        {/* 原有的简单抽签功能（备用） */}
        <Route path="/draw-simple" element={<DrawPage />} />
        <Route path="/groups" element={<GroupsPage />} />
      </Routes>
    </Router>
  );
};

export default App;
